<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.util.RequestUtil"%>
<%@page import="com.shsh.safemanage.action.ActionCreator"%>
<%@page import="com.shsh.safemanage.action.BrowseProblemAction"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="com.shsh.safemanage.model.Defect"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>

<%
{
int currentPage = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_PAGE_NUM, 1);
Integer theProblemType = RequestUtil.getParameter(request, Constants.REQUEST_PARAMETER_PROBLEM_TYPE, (Integer)null);
BrowseProblemAction browseAction = ActionCreator.createBrowseProblemAction();
List<Problem> problemList = browseAction.browseProblemsForShutdown(request);
int totalNum = (Integer) request.getAttribute(Constants.DAO_RESULT_NUMBER);
Integer totalPage = 0;
if (totalNum % Constants.PAGE_SIZE == 0) {
	totalPage = totalNum / Constants.PAGE_SIZE;
} else {
	totalPage = totalNum / Constants.PAGE_SIZE + 1;
}
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
	<tr>
		<td width="8"  class="appbg">&nbsp;</td>
		<td width="85" class="appbg"><img src="images/trace.gif"  style="vertical-align:middle;"/>查询结果</td>
		<td width="229" class="appbg">&nbsp;</td>
		<td width="58" class="appbg">&nbsp;</td>
		<td width="84" class="appbg">&nbsp;</td>
		<td width="74" class="appbg">&nbsp;</td>
		<td colspan="2" class="appbg">&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td colspan="6" height="40">
			查询到<font color="#FF0000"><%=totalNum%></font>条记录，共<font color="#FF0000"><%=totalPage%></font>页。
			<span style="margin-left: 15px; color: red">
			<%
			if (currentPage > 1) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=currentPage-1%>)">【上一页】</a>
			<%
			}
			%>
			第<%=currentPage%>页
			<%
			if (problemList.size() >= Constants.PAGE_SIZE) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=currentPage+1%>)">【下一页】</a>
			<%
			}
			%>
			</span>
		</td>
	</tr>
	<tr>
				<td class="a_text2" width="20%" height="30" align="center" colspan="2">作业部（业务中心）</td>
				<td class="a_text2" width="20%" align="center">装置</td>
				<td width="20%" class="a_text2" align="center">问题标题</td>
				<td width="6%" class="a_text2" align="center">发现人</td>
				<td width="12%" class="a_text2" align="center">填报日期</td>
				<td width="12%" class="a_text2" align="center">回复日期</td>
				<td width="10%" class="a_text2" align="center">查看</td>
	</tr>
	<%
	int row = 0;
	for (Problem problem : problemList) {
		row++;
	%>
	<tr>
		<td colspan="2" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=problem.getDepartment1Name()%></td>
				<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=problem.getEquipmentName()%></td>
				<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=problem.getProblemTitle()%></td>
				<td class="a_text3" align="center" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=problem.getWriteUserName()%></td>
				<td class="a_text3" align="center" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=Util.formatDate(problem.getWriteTime().getTime())%></td>
				<td class="a_text3" align="center" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
					<%=(problem.getCloseTime() == null)? "&nbsp;" : Util.formatDate(problem.getCloseTime().getTime())%></td>
		<td align="center" class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<a href="javascript:" onclick="loadPageSection('<%=request.getContextPath()%>/shutdown/problem_feedback.jsp', 'mainContentDiv', {id:<%=problem.getId()%>, fromPage:'shutdown', problemType: <%=theProblemType%>}, true)"
			style="color: <%=(problem.getProcessStatus() == Constants.PROBLEM_STATUS_CLOSE)? "black":"red"%>">详细内容</a></td>
	</tr>
	<%
	}
	%>
	<tr>
		<td>&nbsp;</td>
		<td colspan="6" height="40">
			查询到<font color="#FF0000"><%=totalNum%></font>条记录，共<font color="#FF0000"><%=totalPage%></font>页。
			<span style="margin-left: 15px; color: red">
			<%
			if (currentPage > 1) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=currentPage-1%>)">【上一页】</a>
			<%
			}
			%>
			第<%=currentPage%>页
			<%
			if (problemList.size() >= Constants.PAGE_SIZE) {
			%>
			<a style="color: #FF0000" href="javascript:" onclick="browseOverallProblems(<%=currentPage+1%>)">【下一页】</a>
			<%
			}
			%>
			</span>
		</td>
	</tr>
</table>
<%
}
%>